window.onload = ()=>{
    let main1 = new Vue({
        el:"#main",
        data:{
            // target:"/test/test.mp4"
        },
        computed:{
            target:()=>{
                // 根据url定位视频
                // console.log(document.URL)
                return document.URL + '/'
            }
        },
        methods:{
            back : function(){
                window.location.pathname = window.location.pathname.split('/').slice(0,-1).join('/')
            }
        },
        created:function(){
        
            if ( document.URL.endsWith("m3u8") && Hls.isSupported()){
                let video = document.getElementById("video")
                let hls = new Hls()
                hls.loadSource(this.target)
                hls.attachMedia(video)
                hls.on(Hls.Events.MANIFEST_PARSED, ()=>{
                    video.play()
                })

            }else{
                document.getElementById('video').play();
            }
        },
    
    })
}